
libname out 'c:\bill\crack\march_cps\kids';
filename ASCIIDAT 'c:\bill\crack\march_cps\kids\cps_00044.dat';

/*
value FOODSTMP_f
  0 = "NIU"
  1 = "No"
  2 = "Yes"
;

value LUNCHSUB_f
  0 = "NIU"
  1 = "Yes, children receive free or reduced price lunch"
  2 = "No, children did not receive free or reduced price lunch"
;


value RACE_f
  100 = "White"
  200 = "Black/Negro"
  300 = "American Indian/Aleut/Eskimo"
  650 = "Asian or Pacific Islander"
  651 = "Asian only"
  652 = "Hawaiian/Pacific Islander only"
  700 = "Other (single) race, n.e.c."
  801 = "White-Black"
  802 = "White-American Indian"
  803 = "White-Asian"
  804 = "White-Hawaiian/Pacific Islander"
  805 = "Black-American Indian"
  806 = "Black-Asian"
  807 = "Black-Hawaiian/Pacific Islander"
  808 = "American Indian-Asian"
  809 = "Asian-Hawaiian/Pacific Islander"
  810 = "White-Black-American Indian"
  811 = "White-Black-Asian"
  812 = "White-American Indian-Asian"
  813 = "White-Asian-Hawaiian/Pacific Islander"
  814 = "White-Black-American Indian-Asian"
  820 = "Two or three races, unspecified"
  830 = "Four or five races, unspecified"
  999 = "NIU"
;

value HISPAN_f
  000 = "Not Hispanic"
  100 = "Mexican"
  102 = "Mexican American"
  103 = "Mexicano/Mexicana"
  104 = "Chicano/Chicana"
  108 = "Mexican (Mexicano)"
  109 = "Mexicano/Chicano"
  200 = "Puerto Rican"
  300 = "Cuban"
  400 = "Other Spanish"
  410 = "Central/South American"
  901 = "Do not know"
  902 = "N/A (and no response 1985-87)"
;
value POVERTY_f
  00 = "NIU"
  10 = "Below poverty"
  20 = "Above poverty"
  21 = "100-124 percent of the low-income level"
  22 = "125-149 percent of the low-income level"
  23 = "150 percent and above the low-income level"
;

value HCOVANY_f
  1 = "Not covered"
  2 = "Covered"
;

value HINSCAID_f
  1 = "Not covered"
  2 = "Covered"
;

run;
*/

data one;
infile ASCIIDAT pad missover lrecl=71;
input
  YEAR       1-4
  SERIAL     5-9
  HWTSUPP    10-19 .4
  STATEFIP   20-21
  METAREA    22-25
  FOODSTMP   26-26
  LUNCHSUB   27-27
  MONTH      28-29
  WTSUPP     30-39 .4
  MOMLOC     40-41
  POPLOC     42-43
  AGE        44-45
  SEX        46-46
  RACE       47-49
  HISPAN     50-52
  FTOTVAL    53-62
  INCWELFR   63-67
  POVERTY    68-69
  HCOVANY    70-70
  HINSCAID   71-71
;

label
  YEAR     = "Survey year"
  SERIAL   = "Household serial number"
  HWTSUPP  = "Household weight, Supplement"
  STATEFIP = "State (FIPS code)"
  METAREA  = "Metropolitan area"
  FOODSTMP = "Food stamp recipiency"
  LUNCHSUB = "Government school lunch food subsidy"
  MONTH    = "Month"
  WTSUPP   = "Supplement Weight"
  MOMLOC   = "Mother's location in the household"
  POPLOC   = "Father's location in the household"
  AGE      = "Age"
  SEX      = "Sex"
  RACE     = "Race"
  HISPAN   = "Hispanic origin"
  FTOTVAL  = "Total family income"
  INCWELFR = "Welfare (public assistance) income"
  POVERTY  = "Official poverty status"
  HCOVANY  = "Any insurance, public or private (summary)"
  HINSCAID = "Any Medicaid/SCHIP/other public insurance (summary)"
;
run;

data two;
set one;

black=(race=200 or race=801 or race=805 or race=806 or race=807 or race=811 or race=814 or race=810);
white=race=100;
if black=1 or white=1;
if hispan=0;
inpoverty=poverty=10;
foodstamps=foodstmp=2;
mommiss=momloc=0;
dadmiss=poploc=0;
momdadmiss=mommiss*dadmiss;
eithermiss=max(mommiss,dadmiss);
length inpoverty foodstamps dadmiss black age sex 3 year statefip 4;
keep statefip year sex black age inpoverty foodstamps dadmiss wtsupp mommiss momdadmiss;
run;




proc sort;
by black;
proc means data=two;
by  black;
class year;
var inpoverty foodstamps dadmiss mommiss momdadmiss;
weight wtsupp;
run;

proc freq;
tables metarea*year;
run;

proc freq;
tables year*momloc;
run;
